﻿@using Common.Views
@using WebApp.Common
@using WebApp.Extensions

@{ var currentUser = (MemberView)ViewBag.CurrentUser; }
@{ var currentPage = (PageSetting)ViewBag.CurrentPage; }

@Html.Scripts(
    @<script type="text/javascript">
        require(['Shared/_MegaMenu'], function (api) {
            $(function () { api.exec('@currentPage.ActiveLink'); });
        });
    </script>
    )

<div class="navbar-collapse nav-main-collapse collapse">
    <div class="container">
        <nav class="nav-main mega-menu">
            <ul class="nav nav-pills nav-main" id="mainMenu">
                <li>
                    @Html.ActionLinkForPage(PageSetting.HomePageSetting, currentPage)
                </li>
                @if (currentUser != null)
                {
                    <li>
                        @Html.ActionLinkForPage(PageSetting.DashboardPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.MemberListPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.ContactListPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.AccountListPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.FolderListPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.TrackLogListPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.LeadListPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.TaskLogListPageSetting, currentPage)
                    </li>
                    <li class="dropdown">
                        <a class="dropdown-toggle" href="#"> Config <i class="icon icon-angle-down"></i> </a>
                        <ul class="dropdown-menu">
                            <li>
                                @Html.ActionLinkForPage(PageSetting.TemplatePageSetting, currentPage)
                            </li>
                            <li>
                                @Html.ActionLinkForPage(PageSetting.ConfigurationPageSetting, currentPage)
                            </li>  
                        </ul>
                    </li>                 
                    <li>
                        @Html.ActionLinkForPage(PageSetting.SignOutPageSetting, currentPage)
                    </li>
                }
                else
                {
                    <li>
                        @Html.ActionLinkForPage(PageSetting.ProductPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.ServicePageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.AboutUsPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.JoinUsPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.ReachUsPageSetting, currentPage)
                    </li>
                    <li>
                        @Html.ActionLinkForPage(PageSetting.SignInPageSetting, currentPage)
                    </li>
                }
            </ul>
        </nav>
    </div>
</div>